﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Unis.YLX.BLL.Domain;
using Unis.YLX.Data.Model;
using Unis.Framework.Core.Utility;
using ScmCostLedgerService;
using System.Data;


namespace Unis.YLX.BLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/2/24 19:26:39
    /// </summary> 
    public class ScmCostledgerUIRule
    {
       private readonly IScmCostledgerService _scmcostledgerService;
        
        
        public ScmCostledgerUIRule(){}
        
        /// <summary> 
        /// construct function... 
        /// </summary> 
        public ScmCostledgerUIRule(IScmCostledgerService  scmCostledgerService)
        {
           _scmcostledgerService=scmCostledgerService;
        }

        /// <summary>
        /// 获取奖励/惩罚台账信息
        /// </summary>
        /// <returns></returns>
        public List<ScmCostledgerInfo> GetAllCostledger()
        {
            var list = _scmcostledgerService.GetEntityList();
            return list;
        }
        /// <summary>
        /// 根据条件查询奖励/惩罚台账信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmCostledgerInfo> GetAllCostLedgerForPage(int numCurrentPage,int numPerPage,string orderByField,out int totalRecord,string sqlCondition)
        {
            var list = _scmcostledgerService.GetEntityListByContionRe(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }
        /// <summary>
        /// 获取奖励/惩罚台账信息 根据ID获取
        /// </summary>
        /// <returns></returns>
        public ScmCostledgerInfo GetCostledgerByID(Guid id)
        {
            var list = _scmcostledgerService.GetEntityById(id);
            return list;
        }

        /// <summary>
        /// 添加奖励/惩罚台账信息
        /// </summary>
        /// <returns></returns>
        public int AddCostledger(ScmCostledgerInfo AddEntity)
        {
            return _scmcostledgerService.InsertEntity(AddEntity);          
        }

        /// <summary>
        /// 删除奖励/惩罚台账信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteCostledger(string id)
        {
            return _scmcostledgerService.DeleteEntityByStringID(id);
        }

        /// <summary>
        /// 删除奖励/惩罚台账信息(批量删除)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteCostledgerMulti(string id)
        {
            return _scmcostledgerService.DeleteEntityByMultiStringID(id);
        }

        /// <summary>
        /// 更新奖励/惩罚台账信息
        /// </summary>
        /// <returns></returns>
        public int UpdateCostledger(ScmCostledgerInfo UpdateEntity)
        {
            return _scmcostledgerService.UpdateEntity(UpdateEntity);
        }

        /// <summary>
        /// 获取所有的安全知识信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <returns></returns>
        public List<ScmCostledgerInfo> GetAllCostLedger(int numCurrentPage, int numPerPage, string orderByField, out int totalRecord)
        {
            var list = _scmcostledgerService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord);
            return list;
        }

        /// <summary>
        /// 根据条件查询安全知识信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmCostledgerInfo> GetCostLedgerForSearch(int numCurrentPage, int numPerPage,
                                                                        string orderByField, out int totalRecord, string sqlCondition)
        {
            var list = _scmcostledgerService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }
        /// <summary>
        /// 获取奖励、惩罚台账信息
        /// </summary>
        /// 
        /// <returns></returns>
        public DataTable GetCostLedgerReport(string type, DateTime? starttime, DateTime? endtime)
        {
            return _scmcostledgerService.GetCostLedgerReport(type,starttime,endtime);
        }
    }
}

